package com.midea.ai.air.ui.more;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.midea.ai.air.R;
import com.midea.ai.air.common.BaseActivity;
import com.midea.ai.air.common.Constant;
import com.midea.ai.air.ui.more.adapter.MoreSettingAirReportIndoorTempAdapter;
import com.midea.ai.air.ui.more.data.MoreDetailedItem;
import com.midea.ai.air.view.ListViewForScrollView;
import com.midea.ai.air.view.MyTitleBar;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by hww on 2016/4/16.
 */
public class MoreSettingAirReportIndoorPM extends BaseActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_moresettingairreportindoorpm);

        init();
    }

    MyTitleBar myTitleBar;
    private TextView actionbar_left_tv;
    private RelativeLayout bar_Rl;
    private List<MoreDetailedItem> mList_datas = new ArrayList<>();
    private ListViewForScrollView mListView;

    private void init() {
        bar_Rl = (RelativeLayout) findViewById(R.id.bar_parent_rl);
        ViewGroup.LayoutParams LP = bar_Rl.getLayoutParams();
        LP.height = Constant.getTopMargin() + getResources().getDimensionPixelSize(R.dimen.height_44dp);
        bar_Rl.setLayoutParams(LP);

        myTitleBar = new MyTitleBar(this);
        myTitleBar.setActionBar_center(R.string.more_setting_24_curve_indoor_PM_title);
        myTitleBar.setActioBar_left(true, R.drawable.register_titler_left, R.string.more_setting_24_curve);
        myTitleBar.setActionBar_right(false, 0);

        actionbar_left_tv = (TextView) findViewById(R.id.actionbar_tv_left);
        actionbar_left_tv.setTextColor(getResources().getColor(R.color.electric_histogram));

        mListView = (ListViewForScrollView) findViewById(R.id.more_setting_air_report_indoor_pm_listView);

        mList_datas.clear();
        for (int i = 0; i < 30; i++) {
            mList_datas.add(new MoreDetailedItem((i + 1) + "日", "000"));
        }

        mListView.setAdapter(new MoreSettingAirReportIndoorTempAdapter(this, mList_datas));

        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(MoreSettingAirReportIndoorPM.this, MoreSettingAirReportIndoorDetail.class);
                Bundle bundle = new Bundle();
                bundle.putString(MoreSettingAirReport.INDOOR_SELECTED_STRING, MoreSettingAirReport.INDOOR_PM);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.actionbar_left_relativeLayout:

                this.finish();
                break;
        }
    }


}
